#endcoding:utf-8

class UserMailer < ActionMailer::Base
  default from: "xwengf@126.com"
  default subject:'51tender验厂服务网'
  def account_activation user,template,link
    @greeting = "您好!"
    @member = user
    @link = link
    if !user.is_a?(User)
      user_emails = []
      user.each do |u|
        user_emails << u.email
      end

      puts YAML::dump(user_emails)
      mail(to: user_emails) do |format|
        format.html { render template }
      end
    else
      mail(to: user.email) do |format|
        format.html { render template }
      end
    end

  end

  # Subject can be set in your I18n file at config/locales/en.yml
  # with the following lookup:
  #
  #   en.user_mailer.password_reset.subject
  #
  def password_reset(user)
    @greeting = "Hi"

    mail to: user.email
  end
end
